SET(TARGET_NAME nim_chatroom_cpp_wrapper)

PROJECT(${TARGET_NAME})

IF (MSVC)
    SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO")
ENDIF ()

INCLUDE_DIRECTORIES(
    ${PROJECT_SOURCE_DIR}
    ${PROJECT_SOURCE_DIR}/..
    ${PROJECT_SOURCE_DIR}/api
    ${PROJECT_SOURCE_DIR}/helper
)

FILE(GLOB_RECURSE NIM_CHATROOM_CPP_SOURCE *.h *.cpp)

ADD_LIBRARY(${TARGET_NAME} ${NIM_CHATROOM_CPP_SOURCE})

SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES FOLDER "cpp_wrappers")

IF (BUILD_SHARED_LIBS)
    ADD_DEFINITIONS(-DCPPWRAPPER_DLL -DNIM_CHATROOM_SDK_CPPWRAPPER_EXPORTS)
    TARGET_LINK_LIBRARIES(${TARGET_NAME} PRIVATE nim_wrapper_util)
ENDIF ()
